package gjfshiyan2.demo;

import org.springframework.boot.CommandLineRunner;
import org.springframework.core.env.Environment;

import java.util.Objects;

@SuppressWarnings("unused")
public class AchieveCommandLineRunner implements CommandLineRunner {
    Environment env;

    public AchieveCommandLineRunner (Environment env){
        this.env = env;
    }

    @Override
    public void run (String...arg) {
        System.out.println("Spring-boot自动装配CommandLineRunner");

        System.out.println("生成随机字符串：".concat(Objects.requireNonNull(env.getProperty("random."))));
    }
}
